package com.wc.alorithm_luogu.P1068;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/5/13 16:19
 * @description https://www.luogu.com.cn/problem/P1068
 * 分数线划定
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();
        m = (int) (m * 1.5);

        Volunteer[] volunteers = new Volunteer[n];
        for (int i = 0; i < n; i++) {
            Volunteer volunteer = new Volunteer();
            volunteer.id = sc.nextInt();
            volunteer.score = sc.nextInt();
            volunteers[i] = volunteer;
        }

        Arrays.sort(volunteers, new Comparator<Volunteer>() {
            @Override
            public int compare(Volunteer o1, Volunteer o2) {
                if (o1.score == o2.score) {
                    return o1.id - o2.id;
                }
                return o2.score - o1.score;
            }
        });

        int passScore = volunteers[m - 1].score;
        while (m < n) {
            if (volunteers[m].score == passScore) {
                m++;
            } else {
                break;
            }
        }
        System.out.println(passScore + " " + m);
        for (int i = 0; i < m; i++) {
            System.out.println(volunteers[i].toString());
        }
    }

    static class Volunteer {
        public int id;
        public int score;

        @Override
        public String toString() {
            return id + " " + score;
        }
    }
}
